home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1996 #15 / Monster Media Number 15 (Monster Media)(July 1996).ISO / bbs_util / bsrc_260.zip / SRC.ZIP / BINK_ASM.ASM < prev    next >
Assembly Source File  |  1996-02-20  |  12KB  |  555 lines

  1. ;--------------------------------------------------------------------------;
  2. ;                                                                          ;
  3. ;                                                                          ;
  4. ;      ------------         Bit-Bucket Software, Co.                       ;
  5. ;      \ 10001101 /         Writers and Distributors of                    ;
  6. ;       \ 011110 /          Freely Available<tm> Software.                 ;
  7. ;        \ 1011 /                                                          ;
  8. ;         ------                                                           ;
  9. ;                                                                          ;
  10. ;              (C) Copyright 1987-96, Bit Bucket Software Co.              ;
  11. ;                                                                          ;
  12. ;                                                                          ;
  13. ;                                                                          ;
  14. ;                   Assembly routines for BinkleyTerm                      ;
  15. ;                                                                          ;
  16. ;                                                                          ;
  17. ;    For complete  details  of the licensing restrictions, please refer    ;
  18. ;    to the License  agreement,  which  is published in its entirety in    ;
  19. ;    the MAKEFILE and BT.C, and also contained in the file LICENSE.260.    ;
  20. ;                                                                          ;
  21. ;    USE  OF THIS FILE IS SUBJECT TO THE  RESTRICTIONS CONTAINED IN THE    ;
  22. ;    BINKLEYTERM  LICENSING  AGREEMENT.  IF YOU DO NOT FIND THE TEXT OF    ;
  23. ;    THIS  AGREEMENT IN ANY OF THE  AFOREMENTIONED FILES,  OR IF YOU DO    ;
  24. ;    NOT HAVE THESE FILES,  YOU  SHOULD  IMMEDIATELY CONTACT BIT BUCKET    ;
  25. ;    SOFTWARE CO.  AT ONE OF THE  ADDRESSES  LISTED BELOW.  IN NO EVENT    ;
  26. ;    SHOULD YOU  PROCEED TO USE THIS FILE  WITHOUT HAVING  ACCEPTED THE    ;
  27. ;    TERMS  OF  THE  BINKLEYTERM  LICENSING  AGREEMENT,  OR  SUCH OTHER    ;
  28. ;    AGREEMENT AS YOU ARE ABLE TO REACH WITH BIT BUCKET SOFTWARE, CO.      ;
  29. ;                                                                          ;
  30. ;                                                                          ;
  31. ; You can contact Bit Bucket Software Co. at any one of the following      ;
  32. ; addresses:                                                               ;
  33. ;                                                                          ;
  34. ; Bit Bucket Software Co.        FidoNet  1:104/501, 1:343/491             ;
  35. ; P.O. Box 460398                AlterNet 7:42/1491                        ;
  36. ; Aurora, CO 80046               BBS-Net  86:2030/1                        ;
  37. ;                                Internet f491.n343.z1.fidonet.org         ;
  38. ;                                                                          ;
  39. ; Please feel free to contact us at any time to share your comments about  ;
  40. ; our software and/or licensing policies.                                  ;
  41. ;                                                                          ;
  42. ;--------------------------------------------------------------------------;
  43.  
  44. .xlist
  45.         page    64,132
  46.         
  47.         title   Bink_Asm
  48.         subttl  by Bob Hartman
  49.         
  50.         .sall
  51. .list
  52.  
  53. ;
  54. ;;;;;;;;;;;;;;;;;;;;;;;;;;;
  55. ;;                       ;;  
  56. ;;     DATA SEGMENT      ;;
  57. ;;                       ;;
  58. ;;;;;;;;;;;;;;;;;;;;;;;;;;;
  59. ;
  60. ;
  61. _DATA    SEGMENT  WORD PUBLIC 'DATA'
  62. _DATA    ENDS
  63. ;CONST    SEGMENT  WORD PUBLIC 'CONST'
  64. ;CONST    ENDS
  65. _BSS    SEGMENT  WORD PUBLIC 'BSS'
  66. _BSS    ENDS
  67. ;DGROUP    GROUP    CONST, _BSS, _DATA
  68. DGROUP    GROUP    _BSS, _DATA
  69. ;
  70. ;
  71. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  72. ;
  73. ;
  74. ;
  75. ;
  76. ;;;;;;;;;;;;;;;;;;;;;;;;;;;
  77. ;;                       ;;  
  78. ;;     CODE SEGMENT      ;;
  79. ;;                       ;;
  80. ;;;;;;;;;;;;;;;;;;;;;;;;;;;
  81. ;
  82. ;
  83. BINK_ASM_TEXT    SEGMENT  WORD PUBLIC 'CODE'
  84.  
  85.     ASSUME  CS: BINK_ASM_TEXT, DS: DGROUP, SS: DGROUP
  86.  
  87.                                 
  88. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  89.  
  90. ;cProc   real_flush,<PUBLIC>
  91. ;        parmW fhandle
  92. ;
  93. ;cBegin
  94.  
  95.     public    _real_flush
  96. _real_flush proc far
  97.     push    bp
  98.     mov    bp,sp
  99.  
  100.         mov     ah,45h
  101. ;       mov     bx,fhandle
  102.     mov    bx, word ptr [bp+6]
  103.  
  104.         int     21h
  105.         jc      rferr
  106.         mov     bx,ax
  107.         mov     ah,3eh
  108.         int     21h
  109.         xor     ax,ax
  110.         jmp     rfout
  111.  
  112. rferr:
  113.         mov     ax,1
  114.  
  115. rfout:
  116.  
  117. ;cEnd
  118.     pop    bp
  119.     ret
  120. _real_flush endp
  121.  
  122.  
  123.  
  124. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  125.  
  126. ;cProc   dv_get_version,<PUBLIC>
  127. ;
  128. ;cBegin
  129.  
  130.     public    _dv_get_version
  131. _dv_get_version proc far
  132.     push    bp
  133.  
  134.         mov     cx,4445h
  135.         mov     dx,5351h
  136.         mov     ax,2b01h
  137.         int     21h
  138.         cmp     al,0ffh
  139.         je      no_dv
  140.         mov     ax,bx
  141.         jmp     short got_dv
  142.  
  143. no_dv:
  144.         xor     ax,ax
  145.  
  146. got_dv:
  147.  
  148. ;cEnd
  149.     pop    bp
  150.     ret
  151. _dv_get_version endp
  152.  
  153.  
  154.  
  155. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  156.  
  157. ;cProc   windows_active,<PUBLIC>
  158. ;
  159. ;cBegin
  160.  
  161.     public    _windows_active
  162. _windows_active proc far
  163.     push    bp
  164.  
  165.     push    es            ; Save old ES
  166.     push    bx            ; Save old BX
  167.     mov    ax,352Fh        ; We are about to clobber them
  168.     int    21h            ; DOS get vector for 2Fh
  169.  
  170.     mov    ax,es            ; ES:BX = vector
  171.     or    ax,bx            ; So let's see if there is one
  172.  
  173.     jz    got_windows        ; Nope, so return the zero
  174.  
  175. ; Int 2f will work. So let's do it.
  176.  
  177.     mov    ax, 1600h         ; test for Windows
  178.     int    2fh            ; Go do the test
  179.     and    ax, 007fh        ; Mask off bit so 80 is same as 0
  180.  
  181. ; Result is now zero if not windows and nonzero if windows. Good enough.
  182.  
  183. got_windows:
  184.  
  185.     pop    bx            ; Restore old bx and es
  186.     pop    es
  187.  
  188. ;cEnd
  189.     pop    bp
  190.     ret
  191. _windows_active endp
  192.  
  193. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  194.  
  195. ;;cProc   dos_box_active,<PUBLIC>
  196. ;;
  197. ;;cBegin
  198.  
  199. ;    public    _dos_box_active
  200. ;_dos_box_active proc far
  201. ;    push    bp
  202.  
  203. ;    push    bx            ; Save old BX
  204. ;    mov    ax,3000h        ; We are about to clobber it
  205. ;    int    21h            ; DOS get version
  206.  
  207. ; We assume OS/2 if major version number >= 10.
  208.  
  209. ;    cmp    al, 0ah
  210. ;    jae    os2ret
  211. ;    xor    ax, ax
  212.  
  213. ; Result is now zero if not OS/2 and nonzero if OS/2. Good enough.
  214.  
  215. os2ret:
  216.  
  217. ;    pop    bx            ; Restore old bx
  218.  
  219. ;;cEnd
  220. ;    pop    bp
  221. ;    ret
  222. ;_dos_box_active endp
  223.  
  224.  
  225.  
  226. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  227.  
  228. ;cProc   mos_active,<PUBLIC>
  229. ;
  230. ;cBegin
  231.  
  232.     public    _mos_active
  233. _mos_active proc far
  234.     push    bp
  235.  
  236.         mov     ah,30h
  237.         int     21h
  238.         push    ax       ;save it
  239.         mov     ax,3000h
  240.         mov     bx,ax
  241.         mov     cx,ax
  242.         mov     dx,ax
  243.         int     21h
  244.         pop     bx
  245.         cmp     ax,bx
  246.         jne     got_mos
  247.         xor     ax,ax
  248.  
  249. got_mos:
  250.  
  251. ;cEnd
  252.     pop    bp
  253.     ret
  254. _mos_active endp
  255.  
  256.  
  257. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  258.  
  259. ;cProc   ddos_active,<PUBLIC>
  260. ;
  261. ;cBegin
  262.     public    _ddos_active
  263. _ddos_active proc far
  264.     push    bp
  265.  
  266. ;
  267. ; This is tricky. On Novell systems, DDOS stuff seems to do something as
  268. ; well. So what we need to do is query Novell, and if so, it's not DDOS.
  269. ; However, the Novell query turns off task switching in DoubleDOS (it
  270. ; declares a critical section). So if we don't find Novell, but we do find
  271. ; DDOS, we have to turn switching back on.
  272. ;
  273.  
  274. ; Query Novell. This will disable task switching if it's DDOS.
  275.  
  276.     xor    ax,ax
  277.     mov    bx,ax
  278.     mov    cx,ax
  279.     mov    ah, 0eah
  280.     int    21h
  281.  
  282. ; What Novell should give us:
  283. ;
  284. ;    ah = 0
  285. ;    al = 0 for IBMPC, 1 for Victor 9000
  286. ;    bh = major shell version
  287. ;    bl = minor shell version
  288. ;    ch = shell type if version >= 3.01
  289. ;    cl = shell revision number
  290.  
  291. ;    Test for zero in ah
  292.  
  293.     cmp    ah, 0
  294.     jne    not_nw
  295.  
  296. ;    Test for bh >= 3 and <= 6
  297.  
  298.     cmp    bh, 3
  299.     jb    not_nw
  300.     cmp    bh, 6
  301.     ja    not_nw
  302.  
  303. ;    We'll guess we're running NW. Don't do the DDOS test.
  304.  
  305.     xor    ax,ax
  306.     jmp    ddos_ret
  307.  
  308. ;    NetWare test failed. Try DDOS.
  309.  
  310. not_nw:
  311.         mov     ah,0e4h
  312.         int     21h
  313.         cmp     al,1
  314.         je      got_ddos
  315.         cmp     al,2
  316.         je      got_ddos
  317.         xor     ax,ax
  318.     jmp    ddos_ret
  319.  
  320. ;    It is DDOS. We have to end the critical section now.
  321.  
  322. got_ddos:
  323.     mov    ah, 0ebh
  324.     int    21h
  325.     mov    ax,1
  326.  
  327. ddos_ret:
  328.  
  329. ;cEnd
  330.     pop    bp
  331.     ret
  332. _ddos_active endp
  333.  
  334.  
  335. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  336.  
  337. ;cProc   tv_get_version,<PUBLIC>
  338. ;
  339. ;cBegin
  340.  
  341.     public    _tv_get_version
  342. _tv_get_version proc far
  343.     push    bp
  344.  
  345.         mov     ax,1022h
  346.         mov     bx,0
  347.         int     15h
  348.         cmp     bx,0
  349.         je      no_tv
  350.         mov     ax,bx
  351.         jmp     short got_tv
  352.  
  353. no_tv:
  354.         xor     ax,ax
  355.  
  356. got_tv:
  357.  
  358. ;cEnd
  359.     pop    bp
  360.     ret
  361. _tv_get_version endp
  362.  
  363.  
  364.  
  365. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  366.  
  367. ;cProc   ml_active,<PUBLIC>,<ds>
  368. ;cBegin 
  369.  
  370.     public    _ml_active
  371. _ml_active proc far
  372.     push    bp
  373.     push    ds
  374.  
  375.         sub     ax,ax
  376.         mov     ds,ax 
  377.         mov     ax,ds:[01feh] 
  378.         cmp     ax,0000 
  379.         je      no_ml 
  380.         jmp     short got_ml 
  381.  
  382. no_ml: 
  383.         xor     ax,ax 
  384.  
  385. got_ml: 
  386.  
  387. ;cEnd 
  388.     pop    ds
  389.     pop    bp
  390.     ret
  391. _ml_active endp
  392.  
  393.  
  394.  
  395. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  396.  
  397. ;cProc   ml_pause,<PUBLIC> 
  398. ;cBegin 
  399.  
  400.     public    _ml_pause
  401. _ml_pause proc far
  402.     push    bp
  403.  
  404.         mov     ah,02h 
  405.         mov     al,00h 
  406.         int     7fh 
  407.  
  408. ;cEnd 
  409.     pop    bp
  410.     ret
  411. _ml_pause endp
  412.  
  413.  
  414.  
  415. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  416.  
  417. ;cProc   dv_pause,<PUBLIC>
  418. ;
  419. ;cBegin
  420.  
  421.     public    _dv_pause
  422. _dv_pause proc far
  423.     push    bp
  424.  
  425.         mov     ax,101ah
  426.         int     15h
  427.         mov     ax,1000h
  428.         int     15h
  429.         mov     ax,1025h
  430.         int     15h
  431.  
  432. ;cEnd
  433.     pop    bp
  434.     ret
  435. _dv_pause endp
  436.  
  437.  
  438.  
  439. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  440.  
  441. ;cProc   tv_pause,<PUBLIC>
  442. ;
  443. ;cBegin
  444.  
  445.     public    _tv_pause
  446. _tv_pause proc far
  447.     push     bp
  448.  
  449.         mov     ax,1000h
  450.         int     15h
  451.  
  452. ;cEnd
  453.     pop    bp
  454.     ret
  455. _tv_pause endp
  456.  
  457.  
  458.  
  459. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  460.  
  461. ;cProc   ddos_pause,<PUBLIC>
  462. ;
  463. ;cBegin
  464.  
  465.     public    _ddos_pause
  466. _ddos_pause proc far
  467.     push    bp
  468.  
  469.         int     0f4h
  470.  
  471. ;cEnd
  472.     pop    bp
  473.     ret
  474. _ddos_pause endp
  475.  
  476.  
  477. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  478.  
  479. ;cProc   windows_pause,<PUBLIC>
  480. ;
  481. ;cBegin
  482.  
  483.     public _windows_pause
  484. _windows_pause proc far
  485.     push    bp
  486.  
  487. ; The good news is that this code works. The bad news is that we can not
  488. ; use it. This is because we will lose interrupts like crazy if we tell
  489. ; Windows that we are idle. Incoming 'RING's will be lost. Yoohoo's. You
  490. ; name it, it would be messed up. I can't think of any way to only do this
  491. ; some of the time -- since 'RING' is asynchronous.
  492. ;
  493. ; If you have a thirst for danger, just use this stuff.
  494. ;
  495.     mov    ax, 1680h    ; Tell Windows
  496.     int    2fh        ; we're idle
  497.  
  498. ;cEnd
  499.     pop    bp
  500.     ret
  501. _windows_pause endp
  502.  
  503.  
  504. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  505.  
  506. ;cProc   mos_pause,<PUBLIC>
  507. ;
  508. ;cBegin
  509.  
  510.     public _mos_pause
  511. _mos_pause proc far
  512.     push    bp
  513.  
  514.         mov     ax,703h
  515.         mov     bx,3          ; Give up three ticks
  516.         xor     cx,cx         ; Clear wait on IRQ mask
  517.         mov     dx,cx         ; Clear ports to wait on
  518.         int     38h
  519.  
  520. ;cEnd
  521.     pop    bp
  522.     ret
  523. _mos_pause endp
  524.  
  525.  
  526. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  527.  
  528. ; The idea for this code came from Holger Schurig
  529.  
  530. ;cProc   msdos_pause,<PUBLIC>
  531. ;
  532. ;cBegin
  533.  
  534.     public    _msdos_pause
  535. _msdos_pause proc far
  536.     push    bp
  537.  
  538.         int     028h
  539.  
  540. ;cEnd
  541.     pop    bp
  542.     ret
  543. _msdos_pause endp
  544.  
  545.  
  546.  
  547. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  548.  
  549. BINK_ASM_TEXT    ENDS
  550.          end
  551.  
  552.  
  553.